home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / BTCLASS.ZIP / BTCLASS@.EXE / BTCLASS.DOC < prev    next >
Encoding:
Text File  |  1992-09-21  |  16.1 KB  |  427 lines

  1. /*//////////////////////////////////////////////////////////////////////////
  2. ///                                                                      ///
  3. ///                                    Btrieve Classes                   ///
  4. ///                                                                      ///
  5. ///                                  Shareware Version 2.02              ///
  6. ///            ___                                                       ///
  7. ///          /_____\                                                     ///
  8. ///         |       |               Copyright (c) 1991, 1992             ///
  9. ///         |   R   |                                                    ///
  10. ///     ----|_______|----                     by                         ///
  11. ///   /------/ | | \------\                                              ///
  12. ///  |       | | | |       |      --  Object Resource Corp.  --          ///
  13. ///  |   O   | | | |   C   |                                             ///
  14. ///  |       |/   \|       |          4323 Brown Suite 249               ///
  15. ///   -------       -------            Dallas,  TX  75219                ///
  16. ///   Object Resource Corp.                                              ///
  17. ///                                      (214) 528-2745                  ///
  18. ///                                                                      ///
  19. ///                                    All Rights Reserved.              ///
  20. ///                                                                      ///
  21. //////////////////////////////////////////////////////////////////////////*/
  22.  
  23.                         ** NOTICE::RIGHTS OF USERS **
  24.  
  25. The freely distributed package may be used for evaluation purposes only.
  26. Inclusion in ANY application for use or for sale requires registration.
  27.  
  28.  
  29. Also required:     TURCBTRV.C  ...  the Btrieve compiler-specific interface
  30.                       or            routines provided with either the Btrieve
  31.                    MSCXBTRV.C       developer's kit or the Btrieve for Windows
  32.                       or            developer's kit from Novell
  33.                    WBTRINTF.C
  34.  
  35.                    Btrieve Version 5.0 or greater
  36.  
  37.                    Borland C++ Version 3.x
  38.                       or
  39.                    Microsoft C++ Version 7.00
  40.  
  41. NOTE: Support for Borland C++ Version 2.0 is available by registration.
  42.  
  43.  
  44. Files included:    BTCLASS.DOC          this file
  45.                    HISTORY.DOC          change history
  46.                    BT.h                 C header
  47.                    BTDEF.HPP            Class Declarations
  48.                    BTDSET.HPP             "         "
  49.                    BTKEY.HPP              "         "
  50.                    BTBUFF.HPP             "         "
  51.                    BTTRAN.HPP             "         "
  52.                    BTMNGER.HPP            "         "
  53.                    BTKDEF.HPP             "         "
  54.                    BTSKDEF.HPP            "         "
  55.                    BTSKEY.HPP             "         "
  56.                    SBTBOR3.LIB          SMALL model class library created
  57.                                            with BORLAND C++ VERSION 3.x
  58.                    SBTMS7.LIB           SMALL model class library created
  59.                                            with Microsoft C++ Version 7.00
  60.                    EXAMPLE.CPP          Example application
  61.                    EXAMPLE.PRJ          Example project file for BORLAND C++
  62.                                            You may need to change the include
  63.                                            and lib directories
  64.                    EXAMPLE.MAK          Example make file for Microsoft
  65.                    EXAMPLES.CPP         Another example application
  66.                    EXAMPLES.HPP         Header for above
  67.                    EXAMPLES.PRJ         Borland Project file for EXAMPLES.CPP
  68.                    EXAMPLES.MAK         Microsoft make file for EXAMPLES.CPP
  69.                    BTUTOR.STD           Short tutorial
  70.                    BTUTOR.HP2           BTUTOR.STD print file for HP2
  71.                    BTUTOR.HP3           BTUTOR.STD print file for HP3
  72.                    TUTOR.HPP            Header file for tutorial
  73.                    TUTOR.CPP            Tutorial source
  74.                    TUTOR.EXE            Executable tutorial
  75.                    TUTOR.PRJ            Project file for Borland
  76.                    TUTOR.MAK            Makefile for Microsoft
  77.  
  78.  
  79.  
  80.                       The Btrieve Class Library
  81.  
  82. The shareware release should provide an application programmer with the full
  83. functionality of Btrieve 5.0.  Please carefully examine the documentation,
  84. the tutorial, the class header files and the example programs, then try some
  85. short programs yourself.
  86.  
  87.  
  88.             ------------------------------------
  89.              CLASS DESCRIPTIONS & RELATIONSHIPS
  90.             ------------------------------------
  91.  
  92. This set of Btrieve classes was constructed as an OO 'wrapper' around the
  93. C interface provided with Btrieve.  One problem with the standard interface
  94. is that it consists of one function call (BTRV) with various meanings at-
  95. tached to the parameters depending on the exact operation being performed.
  96. This is both difficult to learn and quite error prone.
  97.  
  98. These classes have abstracted various roles from the many operations...roles
  99. like 'keyed access path'.  Since these concepts are much closer to how one
  100. thinks about databases, a programmer is now freed from constantly translating
  101. her/his needs into one or more of the many op-codes.  This makes the code much
  102. clearer and maintainable.  An additional benefit for those not experienced
  103. with Btrieve is a much less forbidding learning curve.
  104.  
  105. Much of this COULD be accomplished in C, but C++ offers inheritance so that
  106. the code is not just modular and reusable, but easily customized to a specific
  107. application's needs!
  108.  
  109. Here are the classes with their associated filenames:
  110.  
  111.     BT_Def        BTDEF.HPP
  112.             BTDEF.CPP
  113.  
  114.     BT_KeyDef    BTKDEF.HPP
  115.             BTKDEF.CPP
  116.  
  117.     BT_SuppKeyDef    BTSKDEF.HPP
  118.             BTSKDEF.CPP
  119.  
  120.     BT_DataSet    BTDSET.HPP
  121.             BTDSET.CPP
  122.  
  123.     BT_Key        BTKEY.HPP
  124.             BTKEY.CPP
  125.  
  126.     BT_SuppKey    BTSKEY.HPP
  127.             BTSKEY.CPP
  128.  
  129.     BT_Manager    BTMNGER.HPP
  130.             BTMNGER.CPP
  131.  
  132.     BT_Transaction  BTTRAN.HPP
  133.             BTTRAN.CPP
  134.  
  135.  
  136.  
  137. The classes fall into three groups: definition, access and miscellaneous.
  138.  
  139.     - Definition classes are used to create Btrieve files with
  140.       their associated segmented keys.
  141.  
  142.     - Access classes are used to read, write, or update data.
  143.  
  144.     - Miscellaneous classes include a class to maintain data or key
  145.       buffers.  Also included is a class to provide functionality not
  146.       included in either definition or access classes.
  147.  
  148.  
  149. ********************************
  150. ** Definition Classes: BT_Def **
  151. ********************************
  152.  
  153. This is the class used to define a Btrieve database.  Consult your Btrieve
  154. documentation for the usage of the various flags (which are all 'defined' in
  155. file BT.H).  The normal sequence to define a file is:
  156.  
  157.     - declare an instance of BT_Def
  158.  
  159.     - add key segments (cf. Btrieve docs & BT.H)
  160.  
  161.     - set the alternate collating sequence (if any)
  162.  
  163.     - invoke the CreateBtrieve method with the file name and
  164.       file creation mode
  165.  
  166.  
  167. Note:  You MUST call AddFinalKeySegment to define the last segment of each
  168.        key.  If there is only one segment, use AddFinalKeySegment.  Prior
  169.        segments are defined using AddKeySegment.
  170.  
  171.        BT_Def will automatically calculate the pagesize.  To override simply
  172.        pass your own pagesize via the constructor.
  173.  
  174.        If you need to declare an alternate collating sequence, use either
  175.        SetUpperAlt to use the standard case-insensitive collating sequence,
  176.        or pass your custom collating sequence to SetAltCollSeq.
  177.  
  178.        The destructor will NOT create a database; CreateBtreive MUST be
  179.        called to accomplish that.  Check the returned value to verify
  180.        file creation or to obtain the failure code.
  181.  
  182.  
  183.  
  184. *********************************
  185. ** Definition Class: BT_KeyDef **
  186. *********************************
  187.  
  188. This class is used internally to implement class BT_Def.  Its duty is to
  189. record key information until BT_Def::CreateBtrieve is called.
  190.  
  191.  
  192. *************************************
  193. ** Definition Class: BT_SuppKeyDef **
  194. *************************************
  195.  
  196. Use this class to define a supplemental key for an already existing database.
  197.  
  198.     - delcare an instance of BT_SuppKeyDef
  199.  
  200.     - invoke AddKeySegment/AddFinalKeySegment to define key segment(s)
  201.  
  202.     - invoke the appropriate BT_DataSet method to add the key
  203.  
  204. Note: You should be familiar with key numbering problems associated with
  205.       supplementary keys, especially in a network environment.  Cf. BTDSET.HPP
  206.       for more on this topic.
  207.  
  208.  
  209. ******************************
  210. ** Access Class: BT_DataSet **
  211. ******************************
  212.  
  213. This class is used to gain access to a database; simply pass the Btrieve
  214. file name to the constructor along with the optional ownername and open-
  215. mode.  Since constructors do not return results, use the Status function
  216. to verify success or return a Btrieve error code.
  217.  
  218. Note that by itself this class provides only non-keyed access: the 'step'
  219. operations.
  220.  
  221.  
  222. **************************
  223. ** Access Class: BT_Key **
  224. **************************
  225.  
  226. Use this class (obtained from a BT_DataSet) to access a key path.  Use the
  227. SetKeyVal and GetKeyVal calls to (guess!) set the key (e.g., for GetEqual)
  228. or get the key returned from a call.  The class also provides for the use
  229. of locks and key-only access.
  230.  
  231.  
  232. ******************************
  233. ** Access Class: BT_SuppKey **
  234. ******************************
  235.  
  236. This provides all the functionality of BT_Key, but for a supplemental key.
  237. There is a method provided for dropping the supplemental key (DropKey).
  238.  
  239.  
  240. *****************************
  241. ** Misc. Class: BT_Manager **
  242. *****************************
  243.  
  244. This class provides access to Btrieve operations which are not appropriate
  245. to the other classes.  Simply instanciate and use.
  246.  
  247.  
  248. *********************************
  249. ** Misc. Class: BT_Transaction **
  250. *********************************
  251.  
  252. Instanciate to begin a transaction.  Commit must be called or the transaction
  253. will be aborted by the destructor.
  254.  
  255.  
  256. **************************
  257. ** Misc. Class: BT_Buff **
  258. **************************
  259.  
  260. This class 'manages' the data and key buffers -- this is analogous to the
  261. function of many STRING classes.  A BT_DataSet object has an internal BT_Buff.
  262. The user also has the option of declaring their own instance of a BT_Buff.
  263. BT_Key manages its own internal BT_Buff.
  264.  
  265. Note that many 'internal' data members of this class are protected rather than
  266. private.  This allows easy derivation of classes which are application specific.
  267. These classes would 'know' the details of the record layout.
  268.  
  269. ---------------------- End of Class Descriptions -----------------------------
  270.  
  271.                           The Tutorial Files
  272.  
  273. We have written a short tutorial demonstrating one approach to using the
  274. Btrieve classes in an application (cf. BTUTOR.* and TUTOR.*).  Perhaps
  275. it will be expecially useful to those who have minimal experience with
  276. object technology.  Nevertheless, it's demonstrates only one approach;
  277. others may be equally useful.
  278.  
  279.  
  280.                           Using the Library
  281.  
  282. Place all of the .HPP files, BT.H and the appropriate .LIB in your working
  283. directory  (SBTBOR3.LIB with Borland 3 ... SBTMS7.LIB with Microsoft).  Also
  284. place your copy of the Btrieve interface file in the working directory.  In-
  285. clude the required class definitions in your source and compile using the
  286. SMALL memory model.  Then link with the library.  The example programs ran
  287. successfully when we started Btrieve with the following command line:
  288.  
  289.               btrieve /M:48 /P:4096 /E /T:c:\btrieve.trn
  290.  
  291.  
  292.                Support for Btrieve 5.1 Extended Operations
  293.                          * Commercial Version *
  294.  
  295. Object Resource's first commercial version of the Btrieve classes will be 
  296. available shortly (in beta test as of Sep 92).  The extended operations will 
  297. be supported ONLY in the commercial version.
  298.  
  299.  
  300.                          Object Resource Corporation
  301.  
  302. We are a company dedicated to providing object oriented software components
  303. to the developer community. We have been very pleased with response to this
  304. class library and will offer more in the future...although most will be
  305. via commercial channels.
  306.  
  307.                              User Support
  308.  
  309. We will extend our best efforts to assist you in using these class
  310. libraries.  Support methods include:
  311.  
  312.      CompuServe:   72467,211
  313.  
  314.      Telephone:    (214) 528-2745 (daytime only...leave message)
  315.                    We will return your call (COLLECT) as soon as possible.
  316.  
  317.      Uncle Sam Mail:   Object Resource Corp.
  318.                        4323 Brown, Suite 249
  319.                        Dallas, TX  75219
  320.  
  321.  
  322.                      THIS SOFTWARE IS SHAREWARE !!
  323.  
  324. Shareware is freely distributable software.  This allows potential users
  325. to evaluate whether it is a useful tool for their activities.  It is also
  326. a way around wholesalers and retail outlets; this saves money for every-
  327. one.
  328.  
  329. If you find this class library useful and continue to use it in either
  330. personal, in-house or commercial applications, you are morally bound to
  331. register as a user and pay the registration fee.  (These classes may be
  332. used to save significant development time ... $55 is CHEAP!!)  Don't be-
  333. come an instance of class FreeLoader!
  334.  
  335.  
  336. The shareware registration fee for this release is FIFTY-FIVE U.S. DOLLARS
  337. ($55). TEXAS RESIDENTS MUST ADD STATE SALES TAX. Registered users will 
  338. receive FULL SOURCE CODE for the shareware library, additional DOCUMENTATION 
  339. for class member functions and SUPPORT via CompuServe, US Mail or telephone 
  340. (on your dime).  Additionally, the shareware registration fee may be applied 
  341. to the purchase of the commercial version. (Upon initial release of the
  342. commercial version, shareware registrants will receive an introductory up-
  343. grade offer.)
  344.  
  345.  
  346.  
  347.                           OUTSIDE THE U.S.
  348.  
  349. Registrants outside the United States must add THIRTY U.S. dollars ($30)
  350. to the registration fee for a total of EIGHTY-FIVE DOLLARS ($85).  This
  351. will cover bank collection fees and shipping.
  352.  
  353.  
  354.             ** Expidited Registration for CompuServe Users **
  355.  
  356. If you need to register and receive the source ASAP, please:
  357.  
  358.     1) Express mail (overnight) the registration form along with your check
  359.        or money order to the provided address.
  360.  
  361.        (Please DO NOT use Federal Express.  They do a fine job, but if no one
  362.        is present when they attempt delivery, we must drive to a remote
  363.        part of town to retrieve the package.  The post office is just around
  364.        the corner.)
  365.  
  366.     2) Telephone us to expect the package (we have an answering machine).
  367.  
  368.     Upon receipt of the registration, we will email the necessary files
  369.     to your CompuServe account.
  370.  
  371. ----------------------------<Registration Form>--------------------------------
  372.  
  373.               ---------------------------------------------
  374.   $55          ORG Btrieve Class Library User Registration       Version 2.02
  375.               ---------------------------------------------
  376.                           ** Shareware Version **
  377.  
  378.      (Please PRINT!)
  379.  
  380.      Date:
  381.  
  382.  
  383.      Name:
  384.  
  385.  
  386.      Address:
  387.  
  388.  
  389.      City/St/Zip:
  390.  
  391.      (outside the United States...see note above)
  392.  
  393.  
  394.      Area Code/Phone:
  395.  
  396.      Area Code/Fax:
  397.  
  398.      CompuServe ID (if any):
  399.  
  400.      Briefly, how do you plan to use this product?
  401.  
  402.  
  403.  
  404.  
  405.      Circle the Btrieve environments that you use:
  406.  
  407.               DOS     VAP     NLM     WINDOWS    OTHER
  408.  
  409.      Which compilers do you use?
  410.  
  411.              BORLAND    MICROSOFT     OTHER:_______________
  412.  
  413.      Make check or money order payable to:   OBJECT RESOURCE CORP.
  414.  
  415.      ...and send to:   Object Resource Corp.
  416.                        4323 Brown #249
  417.                        Dallas, TX  75219
  418.  
  419.      Please include your comments and suggestions!
  420.  
  421. ------------------------------------------------------------------------------
  422.  
  423. Thank you!
  424.  
  425. Chuck McWilliam
  426. Object Resource Corp.
  427.